<template>
    <div class="colorFFF font_OPPOSans boxBody bigProgressBar-box">
        <Tabs title="当日巡检完成率">
            <template #btn>
                <div style="width: 10rem"></div>
            </template>
        </Tabs>
        <div class="content-body flex-box flex-direction-column flex-justify-content-space-between">
            <div>
                <p class="percentage">{{ workStatisticsObj.patrolWorkPercentageComplete }}<span
                          class="percentageCompany">
                        %</span></p>
                <bigProgressBar :value="workStatisticsObj.patrolWorkPercentageComplete"></bigProgressBar>
            </div>
            <div class="flex-box flex-justify-content-space-between">
                <div class="confiscate-text flex-box flex-align-items-center">
                    <svg-icon class="data_center_svg" icon-class="data_center_bottom1_svg" />
                    <div class="inline-block">
                        <p class="confiscate-top_text">累计已处理工单</p>
                        <p class="quantity">{{ workStatisticsObj.beingProcessed }}<span
                                  class="quantityCompany"> 件</span></p>
                    </div>
                </div>
                <div class="confiscate-text flex-box flex-align-items-center">
                    <svg-icon class="data_center_svg" icon-class="data_center_bottom2_svg" />
                    <div class="inline-block">
                        <p class="confiscate-top_text">待处理工单</p>
                        <p class="quantity">{{ workStatisticsObj.pending }}<span class="quantityCompany"> 件</span></p>
                    </div>
                </div>
                <div class="confiscate-text flex-box flex-align-items-center">
                    <svg-icon class="data_center_svg" icon-class="data_center_bottom3_svg" />
                    <div class="inline-block">
                        <p class="confiscate-top_text">处理中工单</p>
                        <p class="quantity">{{ workStatisticsObj.cumulativeProcessingTotal }}<span class="quantityCompany">
                                件</span>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import Tabs from "./Tabs.vue"
import BigProgressBar from "./BigProgressBar/index.vue"
import { workStatistics } from "src/api/largeDataScreen";
export default {
    name: "CenterDaysPatrolInspection",
    components: { Tabs, BigProgressBar },
    inject: ['villageId'],
    data() {
        return {
            value: 0.5,
            workStatisticsObj: {
                beingProcessed: 0,
                cumulativeProcessingTotal: 0,
                patrolWorkPercentageComplete: 0,
                pending: 0,
            },
            timer: null
        }
    },
    mounted() {
        this.workStatistics(this.villageId);
        this.timer = setInterval(() => {
            this.workStatistics(this.villageId)
        }, 20000);
    },
    destroyed() {
        clearInterval(this.timer);
        this.timer = null;
    },
    methods: {
        workStatistics(villageId) {
            if (villageId) {
                workStatistics({ id: villageId }).then(response => {
                    if (response.code == 20000) {
                        this.workStatisticsObj = response.data;
                    }
                })
            }
        },
    }
}
</script>

<style scoped>
.boxBody {
    height: 100%;
}

.content-body {
    height: calc(100% - 2.5rem);
}

.confiscate-text {
    flex: 1;
}

.data_center_svg {
    font-size: 4rem;
    margin-right: 0.75rem;
    fill: none;
}

.confiscate-top_text {
    color: rgba(251, 229, 187, 0.8);
    font-size: 0.875rem;
}

.quantity {
    color: #FBE5BB;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 0.375rem rgba(251, 229, 187, 0.4);
}

.quantityCompany {
    font-size: 0.75rem;
    color: #FBE5BB;
    font-weight: normal;
}

.percentage {
    font-size: 1.5rem;
    line-height: 1.25rem;
    color: #FBE5BB;
    margin-bottom: 0.625rem;
    font-weight: bold;
    text-shadow: 0 0 0.375rem rgba(251, 229, 187, 0.4);
    text-align: right;
}

.percentageCompany {
    font-size: 0.75rem;
    line-height: 0.75rem;
    color: #FFFFFF;
    font-weight: normal;
}

.progress_opacity_div {
    position: absolute;
    left: 0.5625rem;
    top: 0.25rem;
}

.progress_opacity_div_item {
    background: #C4C4C4;
    width: 0.5625rem;
    height: 1.5rem;
    border-radius: 2px;
    transform: rotate(16deg);
    display: inline-block;
    margin-left: 1rem;
}
</style>

<style scoped>
.bigProgressBar-box :deep .inner {
    width: auto !important;
}
</style>
